Using a Window or Thread to Manage Buffered Playback

The following messages can be sent to a window or thread for managing playback of MIDI system-exclusive messages or stream buffers:

MM_MOM_CLOSEJPJJ24

Sent when the device is closed by using the midiOutClose2.G._BN function.

MM_MOM_DONEI3GO8.

Sent when the device driver is finished with a data block sent by using the midiOutLongMsg10239RN or midiStreamOut060OP9 function.

MM_MOM_OPENI3ROZE

Sent when the device is opened by using the midiOutOpen1UBKBTS function.

 

A wParam parameter and an lParam parameter are associated with each of these messages. The wParam parameter always specifies the handle of an open MIDI device. For MM_MOM_DONEI3GO8., lParam specifies an address of a MIDIHDR8OW3.JO structure identifying the completed data block. The lParam parameter is unused for MM_MOM_CLOSEJPJJ24 and MM_MOM_OPENI3ROZE.

The most useful message is probably MM_MOM_DONE. Unless you need to allocate memory or initialize variables, you probably do not need to process MM_MOM_OPEN and MM_MOM_CLOSE. When playback of a data block is complete, you can clean up and free the data block.